<template>
	<view class="container">
		<view class="separate">
			<view class="avator">
				<view class="con" @click="navTo('/pages/agent/user/info')">
					<image :src="userInfo.avatar" mode=""></image>
					<text>{{userInfo.nickname}}</text>
					<text>{{userInfo.mobile}}</text>
				</view>
			</view>
			<view class="list">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/img/account/capital.png" mode="widthFix"></image>
						<text>我的资金</text>
					</view>
					<view class="item_r">
						<text>￥{{userInfo.money}}</text>
					</view>
				</view>

			</view>
	<!-- 		<view class="list" @click.stop="navTo('/pages/agent/user/card')">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/img/account/settlement.png" mode="widthFix"></image>
						<text>绑定银行卡</text>
					</view>
					<view class="item_r">
						<image src="/static/img/detail/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view> -->
			<!-- <view class="list" @click.stop="navTo('/pages/agent/user/band_zhifubao')">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/image/auto_login_ali.png" mode="aspectFit" style="height: 15px;"></image>
						<text>绑定支付宝</text>
					</view>
					<view class="item_r">
						<image src="/static/img/detail/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view> -->
			<view class="list" @click="navTo('/pages/agent/user/record_money')">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/img/agent/cash.png" mode="widthFix"></image>
						<text>收益记录</text>
					</view>
					<view class="item_r">
						<image src="/static/img/detail/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view>
		<!-- 	<view class="list" @click="navTo('/pages/agent/user/tixian_money')">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/img/agent/cash.png" mode="widthFix"></image>
						<text>提现记录</text>
					</view>
					<view class="item_r">
						<image src="/static/img/detail/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view> -->
		<!-- 	<view class="list" @click="navTo('/pages/agent/user/operate-manage')">
				<view class="list_item">
					<view class="item_l">
						<image src="/static/img/agent/cash.png" mode="widthFix"></image>
						<text>添加店员</text>
					</view>
					<view class="item_r">
						<image src="/static/img/detail/right.png" mode="widthFix"></image>
					</view>
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		settleRecord,
		getUserInfo
	} from '../../api/api.js'
	export default {
		data() {
			return {
				key: '',
				sum_money: '',
				list: [{
						date: '11-02 11:30',
						money: '28.26'
					},
					{
						date: '11-02 11:30',
						money: '28.26'
					}
				],
				userInfo: {}
			}
		},
		onLoad() {
			// this.userInfo = uni.getStorageSync('user')
			// console.log(this.userInfo)
			// this.getList()
		},
		onShow() {
			this.getUser()
		},
		methods: {
			// 代理
			getList() {
				settleRecord().then(res => {
					console.log(res)
					this.sum_money = res.data.sum_money
					this.list = res.data.data
				})
			},
			getUser(){
				getUserInfo().then(res=>{
					console.log(res)
					this.userInfo = res.data
					uni.setStorageSync('user', res.data)
				})
			},
			toDetailed(id) {
				uni.navigateTo({
					url: '/pages/agent/user/detailed?id=' + id
				})
			},
			navTo(url) {
				uni.navigateTo({
					url: url
				})
			}
		},
	}
</script>

<style scoped lang="scss">
	.container {
		width: 100%;
		height: 100%;
		background-color: #f6f6f6;
	}

	.my {
		width: 100%;
		height: 100%;

		.record {
			width: 100%;
			height: 200upx;
			background-color: #FFFFFF;
			display: flex;
			flex-direction: column;
			align-items: center;
			border-bottom: 1upx solid #e9e6e9;

			.settlement {
				height: 40upx;
				line-height: 40upx;
				display: flex;
				align-items: center;
				margin: 38upx 0 28upx;

				image {
					width: 30upx;
					margin-right: 10upx;
				}
			}

			.money {
				color: #999999;

				text {
					color: #fb817f;
				}
			}
		}

		.account {
			width: 100%;
			background-color: #FFFFFF;

			.wechat {
				width: calc(100%);
				height: 130upx;
				margin: 0 auto;
				border-bottom: 1upx solid #e9e6e9;
				display: flex;
				justify-content: space-between;
				align-items: center;

				.left {
					display: flex;

					image {
						width: 70upx;
					}

					.transfer {
						display: flex;
						flex-direction: column;
						margin-left: 20upx;
						font-size: 24upx;

						text {
							margin-top: 5upx;
						}

						.date {
							color: #999999;
						}
					}
				}

				.right {
					color: #fb817f;
				}
			}

		}

	}

	.separate {
		width: 100%;
		height: 100%;

		.avator {
			width: 100%;
			height: 350upx;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #8faeb3;

			.con {
				display: flex;
				flex-direction: column;
				align-items: center;

				image {
					width: 160upx;
					height: 160upx;
					border-radius: 50%;
					margin-bottom: 20upx;
				}

				text {

					color: #FFFFFF;
				}
			}
		}

		.list {
			width: 100%;
			margin-top: 20upx;
			background-color: #FFFFFF;

			.list_item {
				width: 90%;
				margin: 0 auto;
				height: 90upx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				border-bottom: 1upx solid #f8f6f7;

				image {
					width: 30upx;
				}

				.item_l {
					min-width: 100upx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					image {
						margin-right: 20upx;
					}
				}

				.item_r {
					image {
						width: 15upx;
					}
				}

			}
		}

	}
</style>
